import React from 'react';
import scss from '../../assets/css/MovieItem.scss';
import {Rate} from 'antd';

export default class MovieItem extends React.Component {
    constructor(props) {
        super(props)
        this.state = {};
    }

    componentDidMount() {
    }

    render() {
        console.log(parseFloat(this.props.rating.average) / 2);
        return (
            <div className={scss.box} onClick={this.goDetail}>
                <img src={this.props.images.small} alt="" className={scss.imgBox}/>
                <br/>
                电影名称:{this.props.title}
                <br/>
                上映年份:{this.props.year}
                <br/>
                电影类型:{this.props.genres.join(",")}
                <br/>
                <Rate disabled allowHalf defaultValue={parseFloat(this.props.rating.average) / 2}/>
            </div>
        );
    }

    goDetail = () => {
        this.props.history.push(`/movie/detail/${this.props.id}`)
    }
}
